{m:include "member","header"}
<script type="text/javascript" src="{STATIC_URL}js/yzm_common.js"></script>
<script type="text/javascript" charset="utf-8" src="<?php echo STATIC_URL;?>plugin/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="<?php echo STATIC_URL;?>plugin/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="<?php echo STATIC_URL;?>plugin/ueditor/lang/zh-cn/zh-cn.js"></script>
<div class="yzm_member_container main">
    {m:include "member","left"}
    <div class="main_right">
        <div class="tit">
            <h3>在线投稿</h3>
        </div>
        <div class="main_cont">
            <form method="post" action="{U('publish')}" onsubmit="return chcekall()">
                <table>
                    <tr>
                        <td width="70"><span class="required">*</span>栏目：</td>
                        <td>{$category_data}</td>
                    </tr>
                    <tr>
                        <td><span class="required">*</span>标题：</td>
                        <td><input type="text" name="title" value="" required class="input w370"></td>
                    </tr>
                    <tr>
                        <td>关键字：</td>
                        <td><input type="text" name="keywords" value="" class="input w370"></td>
                    </tr>
                    <tr>
                        <td>缩略图：</td>
                        <td>{form::image('thumb')}</td>
                    </tr>
                    <tr>
                        <td>摘要：</td>
                        <td><textarea name="description" class="textarea" style="width:690px;"></textarea></td>
                    </tr>
                    {loop $fieldstr $val}
                    <tr>
                        <td>{$val[field]}：</td>
                        <td>{$val[form]}</td>
                    </tr>
                    {/loop}
                    <tr style="height:20px;">
                        <td></td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>内容：</td>
                        <td>{form::editor_mini('content')}</td>
                    </tr>
                    <tr>
                        <td></td>
                        <td><input type="submit" name="dosubmit" class="submit" value="提交"></td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
	function change_model(catid) {
		if(catid != 0) location.href = '?catid='+catid;
	}
	
	function chcekall(){
		if($("input[name='title']").val()==''){
			layer.msg("标题不能为空!", {icon:2});
			return false;
		}
		if($("#select").val()=="0"){
			layer.msg("请选择栏目!", {icon:2});
			return false;
		}

		//form必填字段的验证
		{loop $field_check $k=>$v}
			{if ($v['isrequired'] && in_array($v['fieldtype'], array('input', 'textarea')))}
			if($("{$v[fieldtype]}[name='{$k}']").val()==''){
				layer.msg("{$v[errortips]}", {icon:2});
				return false;
			}
			{/if}		
		{/loop}

		if(UE.getEditor('content').getContent()==''){
			layer.msg("内容不能为空!", {icon:2});
			return false;
		}
	}
</script>
{m:include "member","footer"}